package hotel.menu.untils;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SharedPreferencesUntil {

	public static void SavaString(Context context, String key, String value) {

		SharedPreferences preferences = context.getSharedPreferences(
				ConstantID.SP_NAME, Activity.MODE_PRIVATE);
		Editor editor = preferences.edit();
		editor.putString(key, value);
		editor.commit();
	}

	public static void SavaBoolean(Context context, String key, Boolean value) {

		SharedPreferences preferences = context.getSharedPreferences(
				ConstantID.SP_NAME, Activity.MODE_PRIVATE);
		Editor editor = preferences.edit();
		editor.putBoolean(key, value);
		editor.commit();
	}

	public static void SavaInt(Context context, String key, int value) {

		SharedPreferences preferences = context.getSharedPreferences(
				ConstantID.SP_NAME, Activity.MODE_PRIVATE);
		Editor editor = preferences.edit();
		editor.putInt(key, value);
		editor.commit();
	}

	public static String getString(Context context, String key) {

		SharedPreferences preferences = context.getSharedPreferences(
				ConstantID.SP_NAME, Activity.MODE_PRIVATE);
		return preferences.getString(key, null);

	}

	public static boolean getBoolean(Context context, String key) {

		SharedPreferences preferences = context.getSharedPreferences(
				ConstantID.SP_NAME, Activity.MODE_PRIVATE);
		return preferences.getBoolean(key, false);
	}

	public static int GetInt(Context context, String key) {

		SharedPreferences preferences = context.getSharedPreferences(
				ConstantID.SP_NAME, Activity.MODE_PRIVATE);
		return preferences.getInt(key, 0);
	}

	public static void RemoveString(Context context, String key) {

		SharedPreferences preferences = context.getSharedPreferences(
				ConstantID.SP_NAME, Activity.MODE_PRIVATE);
		Editor editor = preferences.edit();
		editor.remove(key);
		editor.commit();
	}

}
